home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / C / Applications / Moscow ML 1.31 / source code / mosml / src / mosmllib / FileSys.sig < prev    next >
Encoding:
Text File  |  1996-07-03  |  4.1 KB  |  108 lines  |  [TEXT/R*ch]

  1. (* OS.FileSys -- SML Standard Library *)
  2.  
  3. type dirstream
  4. datatype access = A_READ | A_WRITE | A_EXEC
  5.  
  6. val openDir   : string -> dirstream
  7. val readDir   : dirstream -> string
  8. val rewindDir : dirstream -> unit
  9. val closeDir  : dirstream -> unit
  10.  
  11. val chDir     : string -> unit
  12. val getDir    : unit -> string
  13. val mkDir     : string -> unit
  14. val rmDir     : string -> unit
  15. val isDir     : string -> bool
  16.  
  17. val realPath  : string -> string
  18. val isLink    : string -> bool
  19. val readLink  : string -> string
  20.  
  21. val modTime   : string -> Time.time
  22. val setTime   : string * Time.time option -> unit
  23. val remove    : string -> unit
  24. val rename    : {old: string, new: string} -> unit
  25. val access    : string * access list -> bool
  26.  
  27. val tmpName   : {dir : string option, prefix : string option} -> string
  28.  
  29. (* These functions operate on the file system.  They raise OS.SysErr
  30.    in case of errors.
  31.  
  32.    [openDir p] opens directory p and returns a directory stream for
  33.    use by readDir, rewindDir, and closeDir.  Subsequent calls to
  34.    readDir will return the directory entries in some unspecified
  35.    order.
  36.  
  37.    [readDir dstr] returns and consumes a file name from the directory
  38.    stream.  If the directory stream is empty (all entries have been
  39.    read), then the empty string "" is returned.
  40.  
  41.    [rewindDir dstr] resets the directory stream as if it had just been
  42.    opened.
  43.  
  44.    [closeDir dstr] closes the directory stream.  All subsequent
  45.    operations on the stream will raise OS.SysErr.
  46.  
  47.    [chDir p] changes the current working directory to p.  This affects
  48.    calls to the functions use, load, compile in the interactive
  49.    system, as well as all functions defined in this library.  If p
  50.    specifies a volume name, then this command also changes the current
  51.    volume (relevant under DOS, Windows, OS/2, etc.).  
  52.  
  53.    [getDir ()] returns the name of the current working directory.
  54.  
  55.    [mkDir p] creates directory p on the file system.
  56.  
  57.    [rmDir p] removes directory p from the file system.
  58.  
  59.    [isDir p] tests whether p is a directory.
  60.  
  61.    [realPath p] returns a canonical form of path p, where all
  62.    occurrences of the arcs ".", "..", "" have been expanded or
  63.    removed, and (under Unix) symbolic links have been fully expanded.
  64.    Raises SysErr if a directory on the path, or the file or directory
  65.    named, does not exist or is not accessible, or if there is a link
  66.    loop.
  67.  
  68.    [isLink p] returns true if p names a symbolic link.  Raises SysErr
  69.    if the file does not exist or there is an access violation.  On
  70.    operating systems without symbolic links, it returns false, or
  71.    raises SysErr if the file does not exist or there is an access
  72.    violation.
  73.  
  74.    [readLink p] returns the contents of the symbolic link p.  Raises
  75.    SysErr if p does not exist or is not a symbolic link, or there is
  76.    an access violation.  On operating systems without symbolic links,
  77.    it raises SysErr.
  78.  
  79.    [modTime p] returns the modification time of file p.
  80.  
  81.    [setTime (p, tmopt)] sets the modification and access time of file
  82.    p.  If tmopt is SOME t, then the time t is used; otherwise the
  83.    current time, that is, Time.now(), is used.
  84.  
  85.    [remove p] deletes file p from the file system.
  86.  
  87.    [rename {old, new}] changes the name of file `old' to `new'.
  88.  
  89.    [access (p, accs)] tests the access permissions of file p,
  90.    expanding symbolic links as necessary.  If the list accs of
  91.    required access permission is empty, it tests whether p exists.  If
  92.    accs contains A_READ, A_WRITE, or A_EXEC, respectively, it tests
  93.    whether the user process has read, write, or execute permission for
  94.    the file.  Never raises an exception.
  95.  
  96.    [tmpName {dir, prefix}] returns a file name suitable for creating a
  97.    fresh temporary file.  Note that there is no guarantee that the
  98.    file name will be unique, since a file of that name may be created
  99.    between the call to tmpName and a subsequent call to open_out which
  100.    creates the file.
  101.  
  102.    If dir is SOME d, then directory d is used; otherwise a
  103.    system-dependent default directory is used (typically /tmp under
  104.    Unix and C:\tmp under DOS).  If prefix is SOME p, then the name of
  105.    the file will consist of the prefix p followed by six letters or
  106.    digits; otherwise a default prefix is used.
  107. *)
  108.